using System;
using System.Globalization;
using WPFTemplateLib.WpfConverters.Core;

namespace WPFTemplateLib.WpfConverters
{
	/// <summary>
	/// [转换器] 判断对象是否为 null
	/// </summary>
	public class ObjectIsNullConverter : ValueConverterBase
	{
		/// <summary>
		/// 是否翻转结果（默认 false）
		/// </summary>
		public bool IsReverse { get; set; }

		public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			bool result = value == null;
			if (IsReverse)
			{
				result = !result;
			}

			return result;
		}
	}
}
